AsukaMilet
10/22/2024, 2:32 PMmax_cache_size_bytes is None, will we write the data to the disk cache?flaneur233
10/22/2024, 2:41 PMAsukaMilet
10/22/2024, 2:49 PMmax_cache_bytes_size is None, I think we should do nothing with elements that are only accessed once.🧐flaneur233
10/22/2024, 3:20 PMflaneur233
10/22/2024, 3:20 PMSome(0) is more like disabling the cacheAsukaMilet
10/22/2024, 3:38 PMmax_cache_bytes_size is None, we will not enable size aware eviction of ghost queue, and the initial size of the ghost queue is set to 32 entries. In this way, we can provide resistance even when there is no evictor.(32 is magic number)AsukaMilet
10/22/2024, 3:40 PMmax_cache_bytes_size is None, it looks like this:
let ghost = LruBuilder::new(NonZeroUsize::new(32).unwrap()).build();flaneur233
10/22/2024, 3:46 PMAsukaMilet
10/22/2024, 3:51 PMAsukaMilet
10/22/2024, 3:51 PMAsukaMilet
10/22/2024, 3:52 PMlet ghost = LruBuilder::new(NonZeroUsize::new(capacity).unwrap()).with_weighter(|_, v: &ObjectMeta| v.size).build();flaneur233
10/22/2024, 3:57 PMghost_queue_capacity? and we can unify them later when we find there is always duplication between these configs. what do you think?AsukaMilet
10/22/2024, 3:59 PMmax_cache_bytes_size is not None, we enable size aware eviction and set the initial capacity of the ghost queue to max_cache_bytes_size * 0.1.AsukaMilet
10/22/2024, 4:05 PMAsukaMilet
10/22/2024, 4:05 PMweighter is introduced is this. If we use a fixed number of entries (e.g. ghost queue holds 32 elements), there will be almost no hit in ghost cache for read dominant workloads and the cache content remains unchanged.AsukaMilet
10/22/2024, 4:06 PMAsukaMilet
10/22/2024, 4:09 PMmax_cache_bytes_size is None.🤣AsukaMilet
10/22/2024, 4:12 PMmax_cache_bytes_size is None, our processing logic is the same as the current implementation. This is how my uncommitted code do right now.AsukaMilet
10/22/2024, 4:15 PMflaneur233
10/23/2024, 3:00 AMAsukaMilet
10/23/2024, 6:13 AM// If `max_cache_size_bytes` is None, `ghost` will be `None` and we do nothing with elements that are only accessed once
let ghost = max_cache_size_bytes.map(|max_cache_size_bytes| {
Arc::new(Mutex::new(
LruBuilder::new(NonZeroUsize::new(max_cache_size_bytes / 10).unwrap())
.with_weighter(|_, v: &ObjectMeta| v.size)
.build(),
))
});
This is how I currently handle it.flaneur233
10/23/2024, 6:13 AMAsukaMilet
10/23/2024, 6:15 AMmax_cache_bytes_size is None, thus providing some resistance.